/**
 * 
 */
package com.feeyin.radar.crm.model;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author E547415
 *
 */
public class BackCostNew 
{
	private Integer id;
	private Integer backCostTypeId;
	private String backCostNum;
	private Date backDate;
	private String backCostDesc;
	private String contractId;
	
	private List<BackCostHistory> backCostHistoryList;
	
	
	public String getContractId() {
		return contractId;
	}
	public void setContractId(String contractId) {
		this.contractId = contractId;
	}
	public List<BackCostHistory> getBackCostHistoryList() {
		return backCostHistoryList;
	}
	public void setBackCostHistoryList(List<BackCostHistory> backCostHistoryList) {
		this.backCostHistoryList = backCostHistoryList;
	}
	public String getBackCostDesc() {
		return backCostDesc;
	}
	public void setBackCostDesc(String backCostDesc) {
		this.backCostDesc = backCostDesc;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getBackCostTypeId() {
		return backCostTypeId;
	}
	public void setBackCostTypeId(Integer backCostTypeId) {
		this.backCostTypeId = backCostTypeId;
	}
	public String getBackCostNum() {
		return backCostNum;
	}
	public void setBackCostNum(String backCostNum) {
		this.backCostNum = backCostNum;
	}
	public Date getBackDate() {
		return backDate;
	}
	public void setBackDate(Date backDate) {
		this.backDate = backDate;
	}

	public Double getBackCostTotal()
	{
		Double result = 0.0;
		for(BackCostHistory history : backCostHistoryList)
		{
			result += history.getHistoryTotal();
		}
		
		return result;
	}
	
	public String getBackDateStr()
	{
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		if(backDate==null)
			backDate = new Date();
		return sdf.format(backDate).toString();
	}
}
